﻿using System.Collections.Generic;

namespace MsTestUtilities.SolutionAnalysis.Testing
{
    public class BuildConfigurationAssert : CollectionAssertionBase<IBuildConfiguration>
    {
        public BuildConfigurationAssert(IEnumerable<IBuildConfiguration> buildConfigurations)
            : base(buildConfigurations)
        {            
        }

        public void WarningsTreatedAsErrors()
        {
            Satisfies(
                c => c.TreatWarningsAsErrors,
                warningsAsErrors => warningsAsErrors,
                b => "Warnings not treated as errors.");
        }

        public void OutputIsUnder(string outputPath)
        {
            Satisfies(
                c => c.OutputPath,
                actual => actual == outputPath,
                actual => string.Format("Expected output path to be under <{0}>. Actual <{1}>.", outputPath, actual.Project.Path));               
        }

        protected override string ElementName(IBuildConfiguration configuration)
        {
            return string.Format("{0} > {1}", configuration.Project.Name, configuration.Name);
        }
    }
}
